<!DOCTYPE html>
<html lang="zh-CN">
<head>
  <meta charset="UTF-8">
  <!-- IE 浏览器运行最新渲染模式(win10, IE 10) -->
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <!-- 浏览器运行高速模式, 针对国内所谓的双核浏览器 -->
  <meta name="renderer" content="webkit">
  <!-- 兼容移动设备 -->
  <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no">
  <link rel="shortcut icon" href="http://oyogbl12f.bkt.clouddn.com/favicon.ico" type="image/x-icon">
  <title>文件上传</title>
</head>
<body>
  <form id="form" action="/server/upload" method="post" enctype="multipart/form-data">
    <input type="file" name="file">
    <input type="submit">
  </form>
  <hr>
  <form action="/server/delete_case" method="post">
    <input type="text" name="url" value="http://127.0.0.1:8000/uploads/e0abfc31cc572a47ad1c8203817f3a83.jpg">
    <input type="submit">
  </form>

  <script>
    let form = document.forms[0];
    
    form.addEventListener('submit', function(e) {
      let formData = new FormData(form);
      fetch(form.action, {
        method: 'POST',
        body: formData
      })
      .then(function(response) {
        return response.json()
      }).then(function(json) {
        console.log('parsed json', json)
      }).catch(function(ex) {
        console.log('parsing failed', ex)
      })
      e.preventDefault();
    });
  </script>
</body>
</html>